# Contributor: Rosie K Languet <rkl@rosiesworkshop.net>
# Maintainer: Rosie K Languet <rkl@rosiesworkshop.net>
pkgname=py3-qt6
pkgver=6.7.1
pkgrel=0
pkgdesc="Python 3 bindings for the Qt toolkit"
url="https://www.riverbankcomputing.com/software/pyqt/"
arch="all"
license="GPL-3.0-only"
depends="
	py3-pyqt6-sip
	python3
	"
makedepends="
	libx11-dev
	py3-dbus-dev
	py3-opengl
	py3-pyqt-builder
	py3-sip
	python3-dev
	qt6-qtbase-dev
	qt6-qtconnectivity-dev
	qt6-qtdeclarative-dev
	qt6-qtmultimedia-dev
	qt6-qtserialport-dev
	qt6-qtsvg-dev
	qt6-qttools-dev
	qt6-qtwebchannel-dev
	qt6-qtwebsockets-dev
	"

subpackages="$pkgname-pyc"
source="https://pypi.python.org/packages/source/P/PyQt6/PyQt6-$pkgver.tar.gz"
builddir="$srcdir/PyQt6-$pkgver"

# FIXME: we have issues upgrading or even rebuilding py3-qt6, possibly since the
# qt6-qtbase upgrade to 6.7.2, so don't upgrade or rebuild for now.
case "$CARCH" in
riscv64)
	pkgver=6.6.1
	pkgrel=1
	;;
esac

build() {
	export CFLAGS="$CFLAGS -O2 -flto=auto"
	export CXXFLAGS="$CXXFLAGS -O2 -flto=auto"
	sip-build \
		--confirm-license \
		--qmake /usr/lib/qt6/bin/qmake \
		--api-dir /usr/share/qt6/qsci/api/python \
		--pep484-pyi \
		--no-make
	make -C build
}

check() {
	make -C build check
}

package() {
	make DESTDIR="$pkgdir" INSTALL_ROOT="$pkgdir" -C build install -j1
	python3 -m compileall -j 0 "$pkgdir"/usr/lib/python3*
}

sha512sums="
1e0fec009e1823b06460fd96eddc00ed31388c20f6d832aa0ebaa130baf06d83514df43af7961c3cb2872570d27e539d6db7bf6143ccdfd61a19da7521be2c7e  PyQt6-6.7.1.tar.gz
"
